<?php

class StudentTransfer_Form_Rein extends StudentTransfer_Form_Transfer
{

    public function init()
    {
        parent::init();
        $arr = array(''=>'choose kind');
        foreach($this->arrayData['transfer']['rein'] as $id=>$val)
        $arr[$id] = $val;
        // 異動類別
        $this->getElement('causation_kind')->setmultiOPtions($arr);
        // 學校名稱縣市可為 null
        $this->getElement('school_name')->setOptions(array('required'=>false));
        $this->getElement('county')->setOptions(array('required'=>false));

        $semester = new Semester_Model_SemesterClass();
        $className = $semester->getGradeClassNames();
        $className = array_merge(array(''=>'choose a class'),$className);
        // 班級
        $this->addElement('select','selClass',array(
            'label'     => 'transfer to class',
            'required' => true,
            'multiOPtions' => $className
        ));
        // 學生
        $this->addElement('text','studentSn',array(
            'label' => 'student name',
            'required' => true,
            'size' => 12
        ));
        // 學號
        $this->addElement('text','student_id',array(
            'label' => 'student ID',
            'required' => true,
            'size' => 10
        ));
        // 座號
        $this->addElement('text','number',array(
            'label' => 'number',
            'required' => true,
            'size' => 6,
            'filters'    => array('StringTrim'),
            'validators' => array('int'),
        ));

        $this->setElementsBelongTo('rein');
    }

}